﻿/*----------------------------------------------------------------
//  <copyright file="SqliteDbContextMigrationPackBase.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-07-03 10:56</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Entity.Sqlite
{
    #region "Sqlite-DbContext迁移模块基类"
    /// <summary>
    /// Sqlite-DbContext迁移模块基类
    /// </summary>
    /// <typeparam name="TDbContext">数据上下文类型</typeparam>
    [DependsOnPacks(typeof(SqliteEntityFrameworkCorePack))]
    [Description("Sqlite-DbContext迁移模块")]
    public abstract class SqliteDbContextMigrationPackBase<TDbContext> : MigrationPackBase<TDbContext>
        where TDbContext : DbContext, IDbContext
    {
        #region "属性"
        #region "获取 数据库类型"
        /// <summary>
        /// 获取 数据库类型
        /// </summary>
        protected override DatabaseType DatabaseType => DatabaseType.Sqlite;
        #endregion

        #endregion

        #region "重写方法"
        #region "重写实现获取数据上下文实例"
        /// <summary>
        /// 重写实现获取数据上下文实例
        /// </summary>
        /// <param name="scopedProvider">服务提供者</param>
        /// <returns></returns>
        protected override TDbContext CreateDbContext(IServiceProvider scopedProvider)
        {   
            return new DesignTimeDbContextFactory<TDbContext>(scopedProvider).CreateDbContext([]);
        }
        #endregion

        #endregion

    }
    #endregion

}
